﻿using System;
using System.Collections.Generic;
using System.Text;

namespace FDStudio.Core.Entities
{
    /*
     CreatedOn: 2018-01-26
     CreatedBy: Jackie Lee(天宇遊龍)
     */
    /// <summary>
    /// 实体字段是否忽略映射
    /// </summary>
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    public class IgnoreAttribute : Attribute
    {
    }

    /// <summary>
    /// 映射列名
    /// </summary>
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    public class ColumnAttribute : Attribute
    {
        /// <summary>
        /// 列名
        /// </summary>
        public string Name { get; set; }

        public ColumnAttribute(string name)
        {
            Name = name;
        }
    }


    /// <summary>
    /// 映射表名
    /// </summary>
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
    public class TableAttribute : Attribute
    {
        /// <summary>
        /// 表名
        /// </summary>
        public string Name { get; set; }

        public TableAttribute(string name)
        {
            Name = name;
        }
    }

    /// <summary>
    /// 别名
    /// </summary>
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property, AllowMultiple = false)]
    public class AliasAttribute : Attribute
    {
        /// <summary>
        /// 别名
        /// </summary>
        public string Name { get; set; }

        public AliasAttribute(string name)
        {
            Name = name;
        }
    }

    /// <summary>
    /// 主键
    /// </summary>
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property, AllowMultiple = false)]
    public class KeyAttribute : Attribute
    {
    }

    /// <summary>
    /// 内联查询属性
    /// </summary>
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    public class JoinAttribute : Attribute
    {
        /// <summary>
        /// 连接对应条件，默认填写子类属性，默认对应元素Id属性
        /// 如为自定义填写条件，需要设置<see cref="OnString"/>为True
        /// </summary>
        public string On { get; set; }

        /// <summary>
        /// 是否自定义连接条件 
        /// </summary>
        public bool OnString { get; set; }

    }

}
